package core.base.exception.validate;

import java.util.Map;
import java.util.TreeMap;

import core.base.exception.ValidateException;
import core.util.MacroVariableInterpreter;
import core.util.MapMacroVariableContainer;

public class DuplicateException extends ValidateException {

	private static final long serialVersionUID = 6579500679541706725L;

	public DuplicateException() {
	}

	private static String formatMessage(String msg, Object[] args) {
		if (args == null) {
			return msg;
		}
		Map<String, Object> map = new TreeMap<String, Object>();
		for (int i = 0; i < args.length; i++) {
			map.put(String.valueOf(i), args[i]);
		}

		MapMacroVariableContainer mvc = new MapMacroVariableContainer(map);
		return MacroVariableInterpreter.interpret(msg, "{", "}", mvc);
	}

	public DuplicateException(String code, String msg) {
		super(code, msg);
	}

	public DuplicateException(String code, String msg, Throwable cause) {
		super(code, msg, cause);
	}

	public DuplicateException(String code, Object[] args, String msg) {
		super(code, args, msg);
	}

	public DuplicateException(String code, Object[] args, String msg, Throwable cause) {
		super(code, args, msg, cause);
	}

	public DuplicateException(String code, String msg, Object... args) {
		super(code, msg, args);
	}

	public DuplicateException(String code, Throwable cause, String msg, Object... args) {
		super(code, msg, cause, args);
	}

	public DuplicateException(Throwable cause) {
		super(cause);
	}
}
